Forward visitor requests when lazily caching examples - #13822
Draft
abidlabs wants to merge 2 commits into
Draft
Conversation
Collaborator
🪼 branch checks and previews
Install Gradio from this PR pip install https://huggingface.co/buckets/gradio/pypi-previews/resolve/f55db4598ffe9a140a9bc30aeffb87a729468834/gradio-6.26.0-py3-none-any.whlInstall Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@f55db4598ffe9a140a9bc30aeffb87a729468834#subdirectory=client/python"Import Gradio JS Client from this PR via CDN import { Client } from "https://huggingface.co/buckets/gradio/npm-previews/resolve/f55db4598ffe9a140a9bc30aeffb87a729468834/browser.js"; |
Collaborator
🦄 change detectedThis Pull Request includes changes to the following packages.
|
Member
Author
Before / after Spaces
Both public Spaces use requested
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Lazy
gr.Examplescaching ran the user function through an internalprocess_apicall withrequest=None, so downstream ZeroGPU clients could not forward the clicking visitor'sX-IP-Token. This passes the click request through the lazy cache path while leaving eager startup caching visitor-less. A regression test covers the API request header reaching the example function.Closes: #13821
AI Disclosure
Testing and Formatting Your Code
PYTHONPATH=client/python:. MPLCONFIGDIR=/tmp/gradio-13821-mpl pytest -q test/test_helpers.py::TestProcessExamples::test_lazy_cache_examples_preserves_requestpython3 -m ruff check gradio/helpers.py test/test_helpers.pypython3 -m ruff format --check gradio/helpers.py test/test_helpers.pyty check --python /Library/Frameworks/Python.framework/Versions/3.14/bin/python3 --extra-search-path client/python gradio/helpers.py test/test_helpers.pyThe repository-wide formatting wrapper could not use its
pythoncommand in this shell, so the equivalent scoped Ruff commands above were run directly. The full launch-based helper class also requires built frontend assets; the new in-process regression passes and CI will run the configured full suite.Minimal reproduction
The demo file is intentionally untracked and was not committed.